#include<bits/stdc++.h>
using namespace std;
int n,m,q,a[155000],l[155000],r[155000];
long long cur[155000],sum,ans;
int curl;
int main() {
    freopen("clear.in","r",stdin);
    freopen("clear.out","w",stdout);
    scanf("%d%d%d",&n,&m,&q);
    for (int i=1;i<=n;i++) scanf("%d",&a[i]);
    for (int i=1;i<=q;i++) scanf("%d%d",&l[i],&r[i]);
    for (int Q=1;Q<=q;Q++) {
        int u=l[Q],v=r[Q];
        curl=u;cur[u]=sum=ans=a[u];
        for (int i=u+1;i<=v;i++) {
            while (curl<=i-m) {
                sum-=cur[curl];
                curl++;
            }
            if (sum<a[i]) {
                cur[i]=a[i]-sum;
                sum+=cur[i];
                ans+=cur[i];
            } else {
                cur[i]=0;
                while (sum>a[i]) {
                    if (cur[curl]>=sum-a[i]) {
                        cur[curl]-=sum-a[i];
                        sum=a[i];
                    } else {
                        sum-=cur[curl];
                        cur[curl]=0;
                        curl++;
                    }
                }
            }
        }
        printf("%lld\n",ans);
    }
    return 0;
}
